#ifndef PLAYER_H
#define PLAYER_H

#include "gameobject.h"
#include <QKeyEvent>

class Player : public GameObject
{
public:
    Player(QGraphicsItem *parent = nullptr);
    void update() override;
    void keyPressEvent(QKeyEvent *event) override;
    int type() const override { return PlayerType; }

    bool isJumping() const { return jumping; }
    void setJumping(bool jump) { jumping = jump; }

    void setLane(int lane) { currentLane = lane; }
    int getLane() const { return currentLane; }

private:
    bool jumping;
    double velocity;
    double gravity;
    double jumpForce;
    int groundLevel;
    int currentLane; // 0: 上, 1: 中, 2: 下
    int laneWidth;
    int moveSpeed;

    void moveLeft();
    void moveRight();
};

#endif // PLAYER_H
